FROM adoptopenjdk/openjdk15

RUN apt-get -qqy update && \
    apt-get -qqy --no-install-recommends install \
    wget \
    gnupg

# 安装 OpenCV，参见：https://github.com/RaiMan/SikuliX1/wiki/macOS-Linux:-Support-Libraries-for-OpenCV-4
RUN apt install libopencv4.2-java openjdk-11-jre-headless -y  \
    && cd /usr/lib/jni/  \
    && ln -s libopencv_java420.so libopencv_java.so \
    && cd /

# 安装 tesseract
RUN apt install tesseract-ocr-* -y \
    && mkdir -p /root/.Sikulix/SikulixTesseract \
    && ln -s /usr/share/tesseract-ocr/4.00/tessdata /root/.Sikulix/SikulixTesseract \
    && cd /

# 初始化 OpenCV lib 库
COPY InitSikuli/target/init-sikuli.jar .
RUN java -jar init-sikuli.jar \
    && rm -f init-sikuli.jar
